package com.yanqu.road.server.manager.cookboy;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.cookboy.CookBoyMatch;
import com.yanqu.road.entity.activity.cookboy.CookBoyMatchDish;
import com.yanqu.road.entity.activity.cookboy.CookBoyMatchRank;
import com.yanqu.road.entity.activity.cookboy.CookBoyMatchReward;
import com.yanqu.road.entity.rank.cross.CrossUserRank;
import com.yanqu.road.logic.bussiness.cross.CrossCookBoyBussiness;
import com.yanqu.road.logic.cross.CrossActivityRankListModel;
import com.yanqu.road.server.connect.CrossAgentLinkedControl;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.pb.cookboy.CookBoyProto;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.activity.relation.CrossRelationRankMgr;
import com.yanqu.road.server.pb.cookboy.CrossCookBoyPb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.utils.date.DateHelper;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class CrossCookBoy {

    private Logger logger = LogManager.getLogger(CrossCookBoy.class.getName());

    private ActivityInfo activityInfo;

    //场次no
    private Map<Integer, CookBoyMatch> cookBoyMatchMap = new ConcurrentHashMap<>();

    private List<CookBoyMatch> needInsertMathList = new ArrayList<>();
    private List<CookBoyMatch> needUpdateMathList = new ArrayList<>();

    private List<Long> windUpSyncCheck = new ArrayList<>();

    public int getActivityId(){
        return activityInfo.getActivityId();
    }

    public ActivityInfo getActivityInfo(){
        return activityInfo;
    }

    public boolean activityInWindUpTime() {
        if(null == activityInfo){
            return false;
        }
        long nowTime = System.currentTimeMillis() / 1000;
        return nowTime >= activityInfo.getEndTime() + 5 * 60 && nowTime < activityInfo.getEndShowTime();
    }

    //活动结束结算下发晋级人员
    public void activityEndWindUp(){
        if(activityInWindUpTime()){
            cookBoyMatchMap = new ConcurrentHashMap<>();
//            logger.error("清除阶段1结束数据");
            //rank userId
            Map<Integer,Long> goodBoyMap = new ConcurrentHashMap<>();
            //同步给本服
            Map<Long,List<Long>> goodBoyServerSyncMap = new ConcurrentHashMap<>();
            int maxRank = CrossCookBoyActivityMgr.getCook1ToCook2Rank(getActivityId());
            CrossActivityRankListModel rankListModel = CrossRelationRankMgr.getCrossActivityRankListModel(getActivityId());
            if(rankListModel == null){
                //启动的时候可能还没全部启动完定时器已经开始跑了，排行榜还没加载完。。。。
                return;
            }
            LinkedList<CrossUserRank> rankList = rankListModel.getRankList();
            int rank = 1;
            for(CrossUserRank userRank : rankList){
                if(rank <= maxRank){
//                    logger.error("阶段1晋级阶段2下发数据，配置文件晋级的排名要求"+rank+",晋级的玩家id:"+userRank.getUserId()+",玩家排名"+rank+",userRank排名:"+userRank.getRank());
                    goodBoyMap.put(userRank.getRank(),userRank.getUserId());
                    if(!goodBoyServerSyncMap.containsKey(userRank.getUserBaseInfo().getServerId())){
                        goodBoyServerSyncMap.put(userRank.getUserBaseInfo().getServerId(),new ArrayList<>());
                    }
                    goodBoyServerSyncMap.get(userRank.getUserBaseInfo().getServerId()).add(userRank.getUserId());
                }
                rank++;
            }
//            int activityId = CrossCookBoyMgr.windUpCookBoy1User(getActivityId(),goodBoyMap);
            windUpCookBoy1UserSyncServer(goodBoyServerSyncMap);
        }
    }

    public void windUpCookBoy1UserSyncServer(Map<Long,List<Long>> goodBoyServerSyncMap){
        for(Long serverId : goodBoyServerSyncMap.keySet()){
            CookBoyProto.CrossCookBoyWindUpMsg.Builder respMsg =
                    CrossCookBoyPb.parseCrossCookBoyWindUpMsg(activityInfo.getActivityId(),goodBoyServerSyncMap.get(serverId));
            YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.S_CROSS_COOK_BOY_TO_COOK_BOY2, respMsg);
            MessageHelper.sendPacket(serverId, 0, pbMsg);
        }
    }

    public void windUpCookBoy1UserSyncServer(int cookBoy2AcId ,Map<Long,List<Long>> goodBoyServerSyncMap){
        if(cookBoy2AcId == 0){
            return;
        }
        for(Long serverId : goodBoyServerSyncMap.keySet()){
            CookBoyProto.CrossCookBoyWindUpMsg.Builder respMsg =
                    CrossCookBoyPb.parseCrossCookBoyWindUpMsg(activityInfo.getActivityId(),goodBoyServerSyncMap.get(serverId));
            YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.S_CROSS_COOK_BOY_TO_COOK_BOY2, respMsg);
            MessageHelper.sendPacket(serverId, 0, pbMsg);
        }
    }

    //阶段1的比赛奖励查询
    public CookBoyMatchReward getMatchReward(long userId,int no){
        CookBoyMatchReward cookBoyMatchReward = new CookBoyMatchReward();
        CookBoyMatch cookBoyMatch = cookBoyMatchMap.get(no);
        if(null == cookBoyMatch){
            cookBoyMatchReward.setRet(GameErrorCode.E_COOK_BOY_FOOD_MATCH_NO_FOUND);
            return cookBoyMatchReward;
        }
        if(cookBoyMatch.getOverTime() == 0){
            cookBoyMatchReward.setRet(GameErrorCode.E_COOK_BOY_FOOD_MATCH_NO_OVER);
            return cookBoyMatchReward;
        }
        Map<Integer,Integer> rankIntegralMap = CrossCookBoyActivityMgr.getMatchRankRewardMap(activityInfo.getActivityId());
        LinkedList<CookBoyMatchRank> rankList = cookBoyMatch.getMatchRankList();
        cookBoyMatchReward.setRankList(rankList);
        int userRank = 0;
        long addValue = 0;
        CookBoyMatchRank userRankData = null;
        //serverId
        int rank = 1;
        for(CookBoyMatchRank cookBoyMatchRank : rankList){
            if(cookBoyMatchRank.getUserId() == userId){
                userRankData = cookBoyMatchRank;
                for(int minRank : rankIntegralMap.keySet()){
                    if(rank < minRank && rankIntegralMap.get(minRank) > 0){
                        if(addValue < rankIntegralMap.get(minRank)){
                            userRank = rank;
                            addValue = rankIntegralMap.get(minRank);
                        }
                    }
                }
            }
            rank++;
        }
        if(addValue != 0){
            cookBoyMatchReward.setActivityId(activityInfo.getActivityId());
            cookBoyMatchReward.setIntegral(addValue * userRankData.getMatchDishList().size());
            cookBoyMatchReward.setNo(cookBoyMatch.getNo());
            cookBoyMatchReward.setRank(userRank);
            cookBoyMatchReward.setUserId(userId);
            for(CookBoyMatchDish cookBoyMatchDish : userRankData.getMatchDishList()){
                cookBoyMatchDish.setRank(cookBoyMatch.getDishRank(cookBoyMatchDish.getUserId(),cookBoyMatchDish.getId()));
            }
            cookBoyMatchReward.setCookBoyMatchDishList(userRankData.getMatchDishList());
            CookBoyMatchDish topDish = userRankData.getMatchDishList().get(0);
            topDish.setRank(cookBoyMatch.getDishRank(topDish.getUserId(),topDish.getId()));
            cookBoyMatchReward.setTopDish(topDish);
            return cookBoyMatchReward;
        }

        cookBoyMatchReward.setRet(GameErrorCode.E_COOK_BOY_FOOD_MATCH_NO_REWARD);
        return cookBoyMatchReward;
    }

    public Map<Long,List<CookBoyMatchReward>> endServeTableMatch(CookBoyMatch cookBoyMatch){
        Map<Long,List<CookBoyMatchReward>> matchRewardMap = new ConcurrentHashMap<>();
        if(cookBoyMatch.getOverTime() != 0){
            return matchRewardMap;
        }
        //结束时间为三个时间点，活动每天的22点结束，人满了结束，每场时间到了结束
        long dayEndTimeStamp = DateHelper.getZeroTimeStamp(cookBoyMatch.getOpenTime()) + CrossCookBoyActivityMgr.getServeFoodEndHour(getActivityId()) * 60 * 60 * 1000;
//        long dayEndTimeStamp = activityInfo.getEndTime() * 1000;
        long matchTime = CrossCookBoyActivityMgr.getServeFoodTableTime(getActivityId()) * 60 * 1000;
        long nowTime = System.currentTimeMillis();
        if(matchTime + cookBoyMatch.getOpenTime() > dayEndTimeStamp && nowTime > dayEndTimeStamp){
            cookBoyMatch.setOverTime(dayEndTimeStamp);
        }else if(nowTime > matchTime + cookBoyMatch.getOpenTime()){
            cookBoyMatch.setOverTime(matchTime + cookBoyMatch.getOpenTime());
        }else {
            cookBoyMatch.setOverTime(nowTime);
        }
        Map<Integer,Integer> rankIntegralMap = CrossCookBoyActivityMgr.getMatchRankRewardMap(activityInfo.getActivityId());
        LinkedList<CookBoyMatchRank> rankList = cookBoyMatch.getMatchRankList();
        int rank = 1;
        //serverId
        for(CookBoyMatchRank cookBoyMatchRank : rankList){
            long addValue = 0;
            for(int minRank : rankIntegralMap.keySet()){
                if(rank < minRank && rankIntegralMap.get(minRank) > 0){
                    if(addValue < rankIntegralMap.get(minRank)){
                        addValue = rankIntegralMap.get(minRank);
                    }
                }
            }
            if(addValue != 0){
                long serverId = cookBoyMatchRank.getServerId();
                if(!matchRewardMap.containsKey(serverId)){
                    matchRewardMap.put(serverId,new ArrayList<>());
                }
                CookBoyMatchReward temp = new CookBoyMatchReward();
                temp.setActivityId(activityInfo.getActivityId());
                temp.setIntegral(addValue * cookBoyMatchRank.getMatchDishList().size());
                temp.setNo(cookBoyMatch.getNo());
                temp.setRank(rank);
                temp.setUserId(cookBoyMatchRank.getUserId());
                for(CookBoyMatchDish cookBoyMatchDish : cookBoyMatchRank.getMatchDishList()){
                    //菜的排名
//                  cookBoyMatchDish.setRank(cookBoyMatch.getDishRank(cookBoyMatchDish.getUserId(),cookBoyMatchDish.getId()));
                    //人的排名
                    cookBoyMatchDish.setRank(rank);
                }
                temp.setCookBoyMatchDishList(cookBoyMatchRank.getMatchDishList());
                matchRewardMap.get(serverId).add(temp);
            }
            rank++;
        }

        synchronized (needUpdateMathList){
            if (!needUpdateMathList.contains(cookBoyMatch)) {
                needUpdateMathList.add(cookBoyMatch);
            }
        }
        return matchRewardMap;
    }

    //生成新的比赛
    public boolean matchCheck(){
        boolean isOver = false;
        boolean isAllConnect = true;
        for (Long serverId : activityInfo.getServerIdList()) {
            if(!CrossAgentLinkedControl.isSeverIdConnection(serverId)){
                isAllConnect = false;
                break;
            }
        }
        if (!isAllConnect) {
            return false;
        }
        Map<Long,List<CookBoyMatchReward>> matchRewardMap = new ConcurrentHashMap<>();
        for(CookBoyMatch cookBoyMatch : cookBoyMatchMap.values()){
            if(cookBoyMatch.getOverTime() != 0)continue;
            //座位坐满了结束//时间到了结束//每天到了晚上22点也结束
            if(cookBoyMatch.getMatchFoodMap().size() >= CrossCookBoyActivityMgr.getServeFoodTableSeat(getActivityId()) ||
                    System.currentTimeMillis() - cookBoyMatch.getOpenTime() > CrossCookBoyActivityMgr.getServeFoodTableTime(getActivityId()) * 60 * 1000 ||
                    !CrossCookBoyActivityMgr.isActivityMatchTime(activityInfo)){
                matchRewardMap = endServeTableMatch(cookBoyMatch);
                isOver = true;
            }
        }
        //已经没有进行中的再开一场
        if(CrossCookBoyActivityMgr.isActivityMatchTime(activityInfo) && CrossCookBoyActivityMgr.activityInTime(activityInfo) &&
                (cookBoyMatchMap.size() == 0 || cookBoyMatchMap.get(cookBoyMatchMap.size()).getOverTime() != 0)){
            if(cookBoyMatchMap.size() == 0){
                CookBoyMatch tempMatch = new CookBoyMatch();
                tempMatch.setActivityId(activityInfo.getActivityId());
                tempMatch.setNo(cookBoyMatchMap.size() + 1);
                tempMatch.setTableData("{}");
                tempMatch.setOpenTime(System.currentTimeMillis());
                cookBoyMatchMap.put(tempMatch.getNo(),tempMatch);
                synchronized (needInsertMathList){
                    needInsertMathList.add(tempMatch);
                }
            }else{
                //停服太久了或者服务器炸了重新生成那些没用的比赛场次否则只会生成一场
                long passTime = System.currentTimeMillis() - cookBoyMatchMap.get(cookBoyMatchMap.size()).getOverTime();
                long matchTime = CrossCookBoyActivityMgr.getServeFoodTableTime(getActivityId()) * 60 * 1000;
                long openTime = cookBoyMatchMap.get(cookBoyMatchMap.size()).getOverTime();
                for(long createMatchTime  = passTime/matchTime + 1;createMatchTime > 0;createMatchTime--){
                    if(!CrossCookBoyActivityMgr.isTimeInMatchTime(activityInfo,openTime)){
                        openTime = openTime + matchTime;
                        continue;
                    }else{
                        //这一场和上一场不是同一天了，直接把开启时间设置成开启时间
                        if(!DateHelper.isSameDay(openTime,cookBoyMatchMap.get(cookBoyMatchMap.size()).getOverTime())){
                            openTime = DateHelper.getTodayZeroTimeStamp() + CrossCookBoyActivityMgr.getServeFoodStartHour(getActivityId()) * 60 * 60 * 1000;
                            CookBoyMatch noOneMatch = new CookBoyMatch();
                            noOneMatch.setActivityId(activityInfo.getActivityId());
                            noOneMatch.setNo(cookBoyMatchMap.size() + 1);
                            noOneMatch.setTableData("{}");
                            noOneMatch.setOpenTime(openTime);
                            cookBoyMatchMap.put(noOneMatch.getNo(),noOneMatch);
                            synchronized (needInsertMathList){
                                needInsertMathList.add(noOneMatch);
                            }
                            break;
                            //换成新的一天了，直接结束掉重新来一遍，不然createMatchTime不会弄了
                        }
                    }
                    CookBoyMatch noOneMatch = new CookBoyMatch();
                    noOneMatch.setActivityId(activityInfo.getActivityId());
                    noOneMatch.setNo(cookBoyMatchMap.size() + 1);
                    noOneMatch.setTableData("{}");
                    noOneMatch.setOpenTime(openTime);
                    cookBoyMatchMap.put(noOneMatch.getNo(),noOneMatch);
                    if(createMatchTime != 1){
                        Map<Long,List<CookBoyMatchReward>> passRewardMap = endServeTableMatch(noOneMatch);//不上赛场的直接结束
                        if(passRewardMap.size() != 0){
                            logger.error(getActivityId()+"小当家活动，存在跳场次没有结算的");
                            syncRewardServer(passRewardMap);
                        }
                        openTime = cookBoyMatchMap.get(cookBoyMatchMap.size()).getOverTime();
                    }
                    synchronized (needInsertMathList){
                        needInsertMathList.add(noOneMatch);
                    }
                }
            }
        }

        syncRewardServer(matchRewardMap);

        if(isOver){
            return true;
        }
        return false;
    }

    private void syncRewardServer(Map<Long,List<CookBoyMatchReward>> matchRewardMap){
        for(long serverId : matchRewardMap.keySet()){
            CookBoyProto.CrossCookBoyMatchOverRewardSyncMsg.Builder respMsg =
                    CrossCookBoyPb.parseCrossCookBoyMatchOverRewardSyncMsg(activityInfo.getActivityId(),matchRewardMap.get(serverId));
            YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.S_CROSS_COOK_BOY_MATCH_OVER_REWARD_SYNC, respMsg);
            MessageHelper.sendPacket(serverId, 0, pbMsg);
        }
    }

    private List<CookBoyMatch> syncMatchList = new ArrayList<>();

    public void syncAllServer(long userId){
        for(long serverId : activityInfo.getServerIdList()){
            CookBoyProto.CrossCookBoyMatchSyncMsg.Builder respMsg =
                    CrossCookBoyPb.parseCrossCookBoyMatchSyncMsg(activityInfo.getActivityId(),syncMatchList);
            YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.S_CROSS_COOK_BOY_MATCH_SYNC, respMsg);
            //随便填个数，保证顺序执行
            MessageHelper.sendPacket(serverId, userId, pbMsg);
        }
        syncMatchList.clear();
    }

    public CookBoyMatch getCookBoyMatch(int no){
        CookBoyMatch cookBoyMatch = cookBoyMatchMap.get(no);
        return cookBoyMatch;
    }

    public Map<Integer, CookBoyMatch> getCookBoyMatch(){
        return cookBoyMatchMap;
    }

    public Map<Integer, CookBoyMatch> getCookBoyMatchHistory(){
        Map<Integer, CookBoyMatch> historyMap = new ConcurrentHashMap<>();
        int limit = CrossCookBoyActivityMgr.getHistoryMatchLimit(getActivityId());
        for(int no = cookBoyMatchMap.size() - 1;no > 0;no--){
            if(limit > 0){
                historyMap.put(no,cookBoyMatchMap.get(no));
            }else{
                break;
            }
            limit--;
        }
        return historyMap;
    }

    //请求上菜菜桌信息
    public void syncFoodTable(long serverId,long userId){
        matchCheck();
        CookBoyMatch cookBoyMatch = cookBoyMatchMap.get(cookBoyMatchMap.size());
        List<CookBoyMatch> syncList = new ArrayList<>();
        syncList.add(cookBoyMatch);
        CookBoyProto.CookBoyPublicTableSyncMsg.Builder respMsg = CrossCookBoyPb.parseCookBoyPublicTableSyncMsg(syncList);
        if(respMsg != null){
            YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.S_CROSS_COOK_BOY_PUBLIC_TABLE_SYNC, respMsg);
            MessageHelper.sendPacket(serverId, userId, pbMsg);
        }
    }

    private int getUserFoodCount(long userId,Map<Integer, CookBoyMatchDish> matchFoodMap){
        int count = 0;
        for(CookBoyMatchDish tempFood : matchFoodMap.values()){
            if(tempFood.getUserId() == userId)count++;
        }
        return count;
    }


    public void serverFoodAll(int no, CookBoyMatchDish cookBoyMatchDish, CookBoyProto.CookBoyFinishFoodTempMsg tempFood){
        matchCheck();
        int ret = serveFood(no,cookBoyMatchDish);
        CookBoyProto.CrossCookBoyServeRespMsg.Builder respMsg = CookBoyProto.CrossCookBoyServeRespMsg.newBuilder();
        CookBoyMatch cookBoyMatch = CrossCookBoyMgr.getCookBoyMatch(activityInfo.getActivityId(),no);
        if(cookBoyMatch == null){
            ret = GameErrorCode.E_COOK_BOY_FOOD_MATCH_NO_FOUND;
        }
        respMsg.setRet(ret);
        if(ret == 0){
            respMsg.setActivityId(activityInfo.getActivityId());
            respMsg.setNo(no);
            respMsg.setFinishFood(tempFood);
            List<CookBoyMatch> syncList = new ArrayList<>();
            syncList.add(cookBoyMatch);
            CookBoyProto.CookBoyPublicTableSyncMsg.Builder publicTableMsg = CrossCookBoyPb.parseCookBoyPublicTableSyncMsg(syncList);
            respMsg.setPublicTable(publicTableMsg);
        }

        YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.S_CROSS_COOK_BOY_SERVE_RESP, respMsg);
        MessageHelper.sendPacket(cookBoyMatchDish.getServerId(), cookBoyMatchDish.getUserId(), pbMsg);
        if(ret == 0){
            syncMatchList.add(cookBoyMatch);
            if(matchCheck()){
                syncMatchList.add(cookBoyMatchMap.get(cookBoyMatchMap.size()));
            }
            syncAllServer(cookBoyMatchDish.getUserId());
        }
    }

    public int serveFood(int no, CookBoyMatchDish cookBoyMatchDish){
        if(!cookBoyMatchMap.containsKey(no)){
            return GameErrorCode.E_COOK_BOY_SERVE_FOOD_NO_ERR;
        }
        CookBoyMatch cookBoyMatch = cookBoyMatchMap.get(no);
        if(cookBoyMatch.getOverTime() != 0){
            return GameErrorCode.E_COOK_BOY_FOOD_MATCH_IS_OVER;
        }
        Map<Integer, CookBoyMatchDish> matchFoodMap = cookBoyMatch.getMatchFoodMap();
        if(matchFoodMap.size() >= CrossCookBoyActivityMgr.getServeFoodTableSeat(getActivityId())){
            return GameErrorCode.E_COOK_BOY_FOOD_MATCH_FULL_SEAT;
        }
        for(CookBoyMatchDish tempFood : matchFoodMap.values()){
            if(tempFood.getId() == cookBoyMatchDish.getId() && tempFood.getUserId() == cookBoyMatchDish.getUserId()){
                return GameErrorCode.E_COOK_BOY_FOOD_IS_SERVE;
            }
        }
        if(getUserFoodCount(cookBoyMatchDish.getUserId(),matchFoodMap) >= CrossCookBoyActivityMgr.getServeFoodTableSingleSeat(getActivityId())){
            return GameErrorCode.E_COOK_BOY_FOOD_MATCH_FULL_SINGLE;
        }
        cookBoyMatchDish.setPos(matchFoodMap.size()+1);
        matchFoodMap.put(matchFoodMap.size()+1,cookBoyMatchDish);
        cookBoyMatch.setMatchFoodMap(matchFoodMap);
        cookBoyMatch.rankChange(cookBoyMatchDish);

        synchronized (needUpdateMathList){
            if (!needUpdateMathList.contains(cookBoyMatch)) {
                needUpdateMathList.add(cookBoyMatch);
            }
        }


        return 0;
    }

    public void timerTask(){
        if(matchCheck()){
            syncMatchList.add(cookBoyMatchMap.get(cookBoyMatchMap.size()));
            syncAllServer(0);
        }

        activityEndWindUp();
    }

    public void syncLoginData(){

    }

    public CrossCookBoy(ActivityInfo acInfo){
        activityInfo = acInfo;
//		reload();
    }

    public boolean reload() {
        cookBoyMatchMap = CrossCookBoyBussiness.getCrossMatchTableMap(activityInfo.getActivityId());
        return true;
    }

    public boolean save() {
        List<CookBoyMatch> tempInsertList;
        synchronized (needInsertMathList) {
            tempInsertList = new ArrayList<>(needInsertMathList);
            needInsertMathList.clear();
        }
        if (tempInsertList.size() > 0) {
            CrossCookBoyBussiness.addCrossMatchTableList(tempInsertList);
        }
        List<CookBoyMatch> tempUpdateList;
        synchronized (needUpdateMathList) {
            tempUpdateList = new ArrayList<>(needUpdateMathList);
            needUpdateMathList.clear();
        }
        if (tempUpdateList.size() > 0) {
            CrossCookBoyBussiness.updateCrossMatchList(tempUpdateList);
        }
        return true;
    }

    public boolean init() {
        return reload();
    }

    public boolean stop() {
        return false;
    }

    /**
     * 预留接口
     */
    public void repair() {

    }

    public void setActivityInfo(ActivityInfo activityInfo){
        this.activityInfo = activityInfo;
    }
}
